package com.hzyl.famousreader.repository.webservice.api;

import android.arch.lifecycle.LiveData;
import com.hzyl.famousreader.repository.persistence.entity.Book;
import com.hzyl.famousreader.repository.persistence.entity.BookChapter;
import com.hzyl.famousreader.repository.webservice.cache.ApiResponse;
import com.hzyl.famousreader.repository.webservice.model.BookWrapper;
import com.hzyl.famousreader.repository.webservice.model.Classification;
import com.hzyl.famousreader.repository.webservice.model.PageWrapper;
import com.hzyl.famousreader.repository.webservice.model.Result;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;

import java.util.List;

/**
 * 书籍API
 */
public interface BookService {

  @GET("android/public/recommends")
  LiveData<ApiResponse<Result<List<BookWrapper>>>> getBooks();

  @GET("android/public/classification")
  LiveData<ApiResponse<Result<List<Classification>>>> classifications();

  @GET("android/public/classificationBooks")
  Call<Result<PageWrapper<Book>>> getClassificationBooks(@Query("pi") Integer pi, @Query("ps") Integer ps, @Query("classificationId") Long classificationId);

  @GET("android/public/chapters")
  LiveData<ApiResponse<Result<List<BookChapter>>>> getChapters(@Query("bookId") Long id);
}
